class Solution {
public:
    int distanceBetweenBusStops(vector<int>& distance, int start, int destination)
    {
        int sum1 = 0;
        int tmp = start;
        int sum2 = 0;
        int n = distance.size();
        while (start != destination)
        {
            sum1 += distance[start];
            start++;
            start %= distance.size();
        }
        start = tmp;
        while (start != destination)
        {
            sum2 += distance[destination];
            destination++;
            destination %= n;
        }
        return sum1 < sum2 ? sum1 : sum2;

    }
};